<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta content="width=device-width,user-scalable=no"name="viewport">
<title>个人信息</title>

<link rel="stylesheet" type="text/css" href="<?php echo C('WEB_URL');?>Public/customer/css/base.css" />
<link rel="stylesheet" type="text/css" href="<?php echo C('WEB_URL');?>Public/customer/css/style.css" />
<link rel="stylesheet" type="text/css" href="<?php echo C('WEB_URL');?>Public/customer/css/bootstrap.min.css" />
<script src="<?php echo C('WEB_URL');?>Public/customer/js/jquery-2.1.4.min.js"></script>
<script src="<?php echo C('WEB_URL');?>Public/customer/js/bootstrap.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="<?php echo C('WEB_URL');?>Public/customer/js/script.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo C('WEB_URL');?>Public/customer/css/mui.picker.min.css" />
</head>
<body>
<div id="box">
 <div class="navbar navbar-default navbar-fixed-top">
  <header>
   <h1><a href="index.html"><span class="glyphicon glyphicon-menu-left"></span></a></h1>
   <p class="title">个人信息</p>
  </header>
 </div><!--navbar-fixed-top-->
 <form id="myForm" method="post">

 <div class="personBox">
   <div class="person">
   <p class="per"><a href="amendTel.html"><span class="telOne">手机：</span><span class="telTwo"><?php echo ($data["user_name"]); ?></span><span class="telThree">></span></a></p>
   <div class="amendTels">
 	<input type="hidden" value="<?php echo ($data["user_name"]); ?>" name='tel'>
 	<input type="hidden" name="birthday" value="" id="birthday">
 	<input type="hidden" name="sex" value="" id="sex12">
  <div class="amTel">
   <label>昵称：</label>
   <input type="text" value="<?php echo ($data["nick_name"]); ?>" class="name" name="nick" />
  </div>
  <div class="amTel">
   <label>性别：</label>
   <div id=sex value='33'>
   <p sex_data='1' style='opacity:<?php if($data["sex"] == 1 ): ?>1
    <?php else: ?>0.58<?php endif; ?>'><img src="<?php echo C('WEB_URL');?>Public/customer/images/button_04.jpg" value='1' /><span>男生</span></p>
   <p sex_data='2' style='opacity:<?php if($data["sex"] == 2 ): ?>1
    <?php else: ?>0.58<?php endif; ?>'><img src="<?php echo C('WEB_URL');?>Public/customer/images/button_05.jpg"  /><span>女生</span></p>
   </div>
   <script>

   </script>
  </div>
  <div class="amTel">
   <label>生日：</label>
   <a id='demo2' name="birthday" data-options='{"type":"date","beginYear":1920,"endYear":2017}' class="btn mui-btn mui-btn-block" value="" ><div id='result' class="ui-alert"><?php echo ($data["birthday"]); ?></div> </a>
  </div>
	
 </div><!--amendTel-->
   <p><!-- <a href="findPwd.html"><span class="telOne">找回密码</span><span class="telThree">></span></a> --></p>
	<!--<button class="cun">11</button>-->
	<div class="amTel">
		
    <div class="cuns" id="cun">保存</div>
   </div>
   <!--<p class="cun"><a href="index.html">保存</a></p>-->
  </div><!--person-->
 </div><!--personBox-->
   </form>
 <div class="navbar navbar-default navbar-fixed-bottom">
   <footer>
    <dl>
     <dt><a href="index.html"><img src="<?php echo C('WEB_URL');?>Public/customer/images/home.png" /></a></dt>
     <dd><a href="index.html" class="current">首页</a></dd>
    </dl>
    <dl>
     <dt><a href="<?php echo U('User/recommends');?>"><img src="<?php echo C('WEB_URL');?>Public/customer/images/mores_17.jpg" /></a></dt>
     <dd><a href="<?php echo U('User/recommends');?>">推荐有奖</a></dd>
    </dl>
    <dl>
     <dt><a href="more.html"><img src="<?php echo C('WEB_URL');?>Public/customer/images/home-03.jpg" /></a></dt>
     <dd><a href="more.html">更多</a></dd>
    </dl>
   </footer>
  </div><!--/navbar-->	
</div><!--box-->
<script type="text/javascript" charset="UTF-8" src="<?php echo C('WEB_URL');?>Public/customer/js/mui.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="<?php echo C('WEB_URL');?>Public/customer/js/mui.picker.min.js"></script>
<script type="text/javascript">
//微信判断
if(isWeiXin()){ 
//alert("====");
$(".title").hide();
} 
else{
//alert("+++++");
}
		//修改生日jQuery
		var myDate = new Date();
        myDate.getYear();        //获取当前年份(2位)
        var fullYear=myDate.getFullYear();    //获取完整的年份(4位,1970-????)
        var data_options='{"type":"date","beginYear":'+(fullYear-100)+',"endYear":'+fullYear+'}';
        $("#demo2").attr("data-options",data_options);
        //console.log("=="+data_options);//输出
        //修改生日jQuery  End
        
			(function($) {
				$.init();
				var result = $('#result')[0];
				var btns = $('.btn');
				btns.each(function(i, btn) {
					btn.addEventListener('tap', function() {
						var optionsJson = this.getAttribute('data-options') || '{}';
						var options = JSON.parse(optionsJson);
						var id = this.getAttribute('id');
						/*
						 * 首次显示时实例化组件
						 * 示例为了简洁，将 options 放在了按钮的 dom 上
						 * 也可以直接通过代码声明 optinos 用于实例化 DtPicker
						 */
						var picker = new $.DtPicker(options);
						picker.show(function(rs) {
							/*
							 * rs.value 拼合后的 value
							 * rs.text 拼合后的 text
							 * rs.y 年，可以通过 rs.y.vaue 和 rs.y.text 获取值和文本
							 * rs.m 月，用法同年
							 * rs.d 日，用法同年
							 * rs.h 时，用法同年
							 * rs.i 分（minutes 的第二个字母），用法同年
							 */
							result.innerText = '' + rs.text;
							/* 
							 * 返回 false 可以阻止选择框的关闭
							 * return false;
							 */
							/*
							 * 释放组件资源，释放后将将不能再操作组件
							 * 通常情况下，不需要示放组件，new DtPicker(options) 后，可以一直使用。
							 * 当前示例，因为内容较多，如不进行资原释放，在某些设备上会较慢。
							 * 所以每次用完便立即调用 dispose 进行释放，下次用时再创建新实例。
							 */
							picker.dispose();
						});
					}, false);
				});
			})(mui);

			function check_form(form_id) {
				last_submit = $('#' + form_id).data('last_submit');
				current_submit = new Date().getTime();
				if (last_submit == undefined) {
					$('#' + form_id).data('last_submit', new Date().getTime());
				} else {
					if (current_submit - last_submit > 600) {
						$('#' + form_id).data('last_submit', new Date().getTime());
					} else {
						return false;
					}
				}
				if ( typeof (tinyMCE) != 'undefined') {
					tinyMCE.triggerSave(true);
				}

				var check_flag = true;
				$("#" + form_id + " :input").each(function(i) {
					if ($(this).attr("check")) {
						if (!validate($(this).val(), $(this).attr("check"))) {
							ui_error($(this).attr("msg"));
							$(this).focus();
							check_flag = false;
							return check_flag;
						}
					}
				});
				return check_flag;
			}


			function sendForm(formId, post_url, return_url) {
				if (check_form(formId)) {
					//绑定beforeunload事件
					$(window).unbind('beforeunload', null);
					if ($("#ajax").val() == 1) {
						var vars = $("#" + formId).serialize();
						$.ajax({
							type : "POST",
							url : post_url,
							data : vars,
							dataType : "json",
							success : function(data) {
								if (data.status) {
									ui_alert(data.info, function() {
										if (return_url) {
											location.href = return_url;
										}
									});
								} else {
									ui_error(data.info);
								}
							}
						});
					} else {
						$("#" + formId).attr("action", post_url);
						if (return_url) {
							set_cookie('return_url', return_url);
						}
						$("#" + formId).submit();
					}
				}
			}
			$('#sex p').click(function(){
				
				$('#sex p').css('opacity','0.58');
				$(this).css('opacity','1');
				$('#sex12').val($(this).attr('sex_data'));
			});
			$('#cun').click(function(){
			
				$('#birthday').val($('#result').html());
				// alert($('#sex p').children('span').attr('style','hover').html());  
				sendForm("myForm","<?php echo U('User/edit');?>");
			})

			
		</script>


</body>
</html>